﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="Attendance.aspx.cs" Inherits="user_Attendance" %>

<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:Content ID="Content3" ContentPlaceHolderID="cphPageTitle" runat="Server">
    <h1>
        <asp:Label runat="server" Text="Attendance" ID="lblPageName"></asp:Label></h1>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:Label runat="server" Text="<%$Resources:General,LangOption%>" Visible="false"
        ID="lblLangOption" />
    <asp:HyperLink runat="server" Visible="false" ID="lnkNewCarUsage" NavigateUrl="#"
        Text="New"></asp:HyperLink>
    <div class="bc2">
        <asp:Label runat="server" ID="lblSiteLocation" Text="You are here : " CssClass="bclist" />
        <asp:SiteMapPath SiteMapProvider="SiteUserSiteMapProvider" ID="smpProvider" runat="server"
            PathSeparator=" : ">
            <PathSeparatorStyle CssClass="bcarrow" />
            <CurrentNodeStyle CssClass="bclist" />
            <NodeStyle CssClass="bclink" />
            <RootNodeStyle CssClass="bclink" />
        </asp:SiteMapPath>
        <div class="clear">
        </div>
    </div>
    <div id="divChangePassword" class="toggle" runat="server">
        <div class="title opened" id="opened1">
            <img src="../images/icons/dark/key.png" alt="" class="titleIcon" />
            <h6>
                <asp:Label ID="lblPageHeader" runat="server" Text="Attendance" />
            </h6>
        </div>
        <div class="form">
            <fieldset class="step">
                <asp:UpdatePanel ID="upnlDetails" runat="server">
                    <ContentTemplate>
                        <asp:Panel ID="pnlDetails" runat="server">
                            <div class="formRow">
                                <asp:Label runat="server" ID="lblAgentNameCaption" Text="Broker Name" />
                                <div class="formRight">
                                    <asp:DropDownList runat="server" ID="ddlAgent" AutoPostBack="True" OnSelectedIndexChanged="ddlAgent_SelectedIndexChanged" />
                                    <asp:Label runat="server" ID="lblAttID" Text="0" Visible="false" />
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                            <div class="formRow">
                                <asp:Label runat="server" ID="lblAdminNameCaption" Text="Admin/Supervisor" />
                                <div class="formRight">
                                    <asp:Label runat="server" ID="lblAdminName" Text="Agent" />
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                            <div class="formRow">
                                <asp:Label runat="server" ID="lblAttTypeCaption" Text="Att. Type" />
                                <div class="formRight">
                                    <asp:DropDownList ID="ddlAttType" runat="server">
                                        <asp:ListItem Text="Annual Leave" Value="101" />
                                        <asp:ListItem Text="Sick Leave" Value="102" />
                                        <asp:ListItem Text="Urgent Leave" Value="103" />
                                        <asp:ListItem Text="Absent" Value="104" />
                                        <asp:ListItem Text="Absent (Others)" Value="199" />
                                    </asp:DropDownList>
                                    <asp:DropDownList runat="server" ID="ddlDayPart" AutoPostBack="True" 
                                        onselectedindexchanged="ddlDayPart_SelectedIndexChanged">
                                        <asp:ListItem Text="Full Day" Value="1" />
                                        <asp:ListItem Text="Morning - Half Day" Value="2" />
                                        <asp:ListItem Text="Evening - Half Day" Value="3" />
                                        <asp:ListItem Text="Excuse - Time Off" Value="4" />
                                        <asp:ListItem Text="Others" Value="99" />
                                    </asp:DropDownList>
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                            <div class="formRow">
                                <asp:Label runat="server" ID="lblDate" Text="Dates" />
                                <div class="formRight">
                                    <asp:DropDownList ID="ddlFromYear" runat="server" />
                                    <asp:DropDownList ID="ddlFromMonth" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlFromMonth_SelectedIndexChanged">
                                        <asp:ListItem Value="01">Jan</asp:ListItem>
                                        <asp:ListItem Value="02">Feb</asp:ListItem>
                                        <asp:ListItem Value="03">Mar</asp:ListItem>
                                        <asp:ListItem Value="04">Apr</asp:ListItem>
                                        <asp:ListItem Value="05">May</asp:ListItem>
                                        <asp:ListItem Value="06">Jun</asp:ListItem>
                                        <asp:ListItem Value="07">Jul</asp:ListItem>
                                        <asp:ListItem Value="08">Aug</asp:ListItem>
                                        <asp:ListItem Value="09">Sep</asp:ListItem>
                                        <asp:ListItem Value="10">Oct</asp:ListItem>
                                        <asp:ListItem Value="11">Nov</asp:ListItem>
                                        <asp:ListItem Value="12">Dec</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:DropDownList ID="ddlFromDay" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlFromDay_SelectedIndexChanged">
                                        <asp:ListItem Value="01">01</asp:ListItem>
                                        <asp:ListItem Value="02">02</asp:ListItem>
                                        <asp:ListItem Value="03">03</asp:ListItem>
                                        <asp:ListItem Value="04">04</asp:ListItem>
                                        <asp:ListItem Value="05">05</asp:ListItem>
                                        <asp:ListItem Value="06">06</asp:ListItem>
                                        <asp:ListItem Value="07">07</asp:ListItem>
                                        <asp:ListItem Value="08">08</asp:ListItem>
                                        <asp:ListItem Value="09">09</asp:ListItem>
                                        <asp:ListItem Value="10">10</asp:ListItem>
                                        <asp:ListItem Value="11">11</asp:ListItem>
                                        <asp:ListItem Value="12">12</asp:ListItem>
                                        <asp:ListItem Value="13">13</asp:ListItem>
                                        <asp:ListItem Value="14">14</asp:ListItem>
                                        <asp:ListItem Value="15">15</asp:ListItem>
                                        <asp:ListItem Value="16">16</asp:ListItem>
                                        <asp:ListItem Value="17">17</asp:ListItem>
                                        <asp:ListItem Value="18">18</asp:ListItem>
                                        <asp:ListItem Value="19">19</asp:ListItem>
                                        <asp:ListItem Value="20">20</asp:ListItem>
                                        <asp:ListItem Value="21">21</asp:ListItem>
                                        <asp:ListItem Value="22">22</asp:ListItem>
                                        <asp:ListItem Value="23">23</asp:ListItem>
                                        <asp:ListItem Value="24">24</asp:ListItem>
                                        <asp:ListItem Value="25">25</asp:ListItem>
                                        <asp:ListItem Value="26">26</asp:ListItem>
                                        <asp:ListItem Value="27">27</asp:ListItem>
                                        <asp:ListItem Value="28">28</asp:ListItem>
                                        <asp:ListItem Value="29">29</asp:ListItem>
                                        <asp:ListItem Value="30">30</asp:ListItem>
                                        <asp:ListItem Value="31">31</asp:ListItem>
                                    </asp:DropDownList>
                                    &nbsp;To&nbsp;
                                    <asp:DropDownList ID="ddlToYear" runat="server" />
                                    <asp:DropDownList ID="ddlToMonth" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlToMonth_SelectedIndexChanged">
                                        <asp:ListItem Value="01">Jan</asp:ListItem>
                                        <asp:ListItem Value="02">Feb</asp:ListItem>
                                        <asp:ListItem Value="03">Mar</asp:ListItem>
                                        <asp:ListItem Value="04">Apr</asp:ListItem>
                                        <asp:ListItem Value="05">May</asp:ListItem>
                                        <asp:ListItem Value="06">Jun</asp:ListItem>
                                        <asp:ListItem Value="07">Jul</asp:ListItem>
                                        <asp:ListItem Value="08">Aug</asp:ListItem>
                                        <asp:ListItem Value="09">Sep</asp:ListItem>
                                        <asp:ListItem Value="10">Oct</asp:ListItem>
                                        <asp:ListItem Value="11">Nov</asp:ListItem>
                                        <asp:ListItem Value="12">Dec</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:DropDownList ID="ddlToDay" runat="server" AutoPostBack="True" 
                                        onselectedindexchanged="ddlToDay_SelectedIndexChanged">
                                        <asp:ListItem Value="01">01</asp:ListItem>
                                        <asp:ListItem Value="02">02</asp:ListItem>
                                        <asp:ListItem Value="03">03</asp:ListItem>
                                        <asp:ListItem Value="04">04</asp:ListItem>
                                        <asp:ListItem Value="05">05</asp:ListItem>
                                        <asp:ListItem Value="06">06</asp:ListItem>
                                        <asp:ListItem Value="07">07</asp:ListItem>
                                        <asp:ListItem Value="08">08</asp:ListItem>
                                        <asp:ListItem Value="09">09</asp:ListItem>
                                        <asp:ListItem Value="10">10</asp:ListItem>
                                        <asp:ListItem Value="11">11</asp:ListItem>
                                        <asp:ListItem Value="12">12</asp:ListItem>
                                        <asp:ListItem Value="13">13</asp:ListItem>
                                        <asp:ListItem Value="14">14</asp:ListItem>
                                        <asp:ListItem Value="15">15</asp:ListItem>
                                        <asp:ListItem Value="16">16</asp:ListItem>
                                        <asp:ListItem Value="17">17</asp:ListItem>
                                        <asp:ListItem Value="18">18</asp:ListItem>
                                        <asp:ListItem Value="19">19</asp:ListItem>
                                        <asp:ListItem Value="20">20</asp:ListItem>
                                        <asp:ListItem Value="21">21</asp:ListItem>
                                        <asp:ListItem Value="22">22</asp:ListItem>
                                        <asp:ListItem Value="23">23</asp:ListItem>
                                        <asp:ListItem Value="24">24</asp:ListItem>
                                        <asp:ListItem Value="25">25</asp:ListItem>
                                        <asp:ListItem Value="26">26</asp:ListItem>
                                        <asp:ListItem Value="27">27</asp:ListItem>
                                        <asp:ListItem Value="28">28</asp:ListItem>
                                        <asp:ListItem Value="29">29</asp:ListItem>
                                        <asp:ListItem Value="30">30</asp:ListItem>
                                        <asp:ListItem Value="31">31</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:Label runat="server" ID="lblTotalDays" ForeColor="Red" Font-Bold="true" />
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                            <div class="formRow">
                                <asp:Label runat="server" ID="lblRemarkCaption" Text="Remark" />
                                <div class="formRight">
                                    <asp:TextBox runat="server" ID="txtRemark" Rows="5" Columns="50" TextMode="MultiLine"
                                        Width="300px" />
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                            <div class="formRow">
                                <asp:Label runat="server" ID="Label7" Text="" />
                                <div class="formRight">
                                    <asp:Button ID="btnSubmit" runat="server" CssClass="blueB ml10" OnClick="btnSubmit_Click"
                                        Text="Submit" ValidationGroup="attendance" OnClientClick="javascript:return confirm('Are you sure to SUBMIT?');" />&nbsp;
                                    <asp:Button ID="btnNew" CausesValidation="false" runat="server" CssClass="blueB ml10"
                                        OnClick="btnNew_Click" Text="New" OnClientClick="javascript:return confirm('Are you sure to NEW?');" />&nbsp;
                                    <asp:Button ID="btnDelete" Enabled="False" CausesValidation="false" runat="server"
                                        CssClass="blueB ml10" OnClick="btnDelete_Click" Text="Delete" OnClientClick="javascript:return confirm('Are you sure to DELETE?');" />&nbsp;
                                    <br />
                                    <asp:Label ID="lblMessage" ForeColor="Red" runat="server"></asp:Label>
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                        </asp:Panel>
                        <p style="color: Red;">
                            <b>History - Last 10 records only.</b></p>
                        <div class="toggle">
                            <asp:GridView ID="grvAttendance" runat="server" AutoGenerateColumns="False" CssClass="sTable"
                                DataKeyNames="AttID" DataSourceID="sqlDSAttendance" EmptyDataText="<%$ Resources:General,ErrNodata %>"
                                GridLines="None" OnSelectedIndexChanged="grvAttendance_SelectedIndexChanged"
                                Width="100%">
                                <Columns>
                                    <asp:BoundField DataField="AttID" HeaderText="Ref. No." SortExpression="AttID" Visible="true" />
                                    <asp:BoundField DataField="AgentName" HeaderText="<%$Resources:General,Broker%>"
                                        SortExpression="AgentName" />
                                    <asp:BoundField DataField="AttTypeDesc" HeaderText="Att. Type" SortExpression="AttTypeDesc"
                                        Visible="true" />
                                    <asp:BoundField DataField="LeaveDayPartDesc" HeaderText="Day Part" SortExpression="LeaveDayPartDesc"
                                        Visible="true" />
                                    <asp:BoundField DataField="DateFrom" DataFormatString="{0:dd/MMM/yyyy}" HeaderText="From"
                                        SortExpression="DateFrom" Visible="true" />
                                    <asp:BoundField DataField="DateTo" DataFormatString="{0:dd/MMM/yyyy}" HeaderText="To"
                                        SortExpression="DateTo" Visible="true" />
                                    <asp:BoundField DataField="AdminName" HeaderText="Admin Name" SortExpression="AdminName"
                                        Visible="true" />
                                    <asp:BoundField DataField="ModifiedDate" DataFormatString="{0:dd/MM/yyyy hh:mm tt}"
                                        HeaderText="Date/Time" SortExpression="ModifiedDate" />
                                    <asp:CommandField ButtonType="Button" ShowSelectButton="true" ControlStyle-CssClass="blueB ml10" />
                                </Columns>
                                <FooterStyle />
                                <PagerStyle />
                                <SelectedRowStyle />
                                <HeaderStyle />
                                <EditRowStyle />
                                <AlternatingRowStyle />
                                <RowStyle />
                            </asp:GridView>
                            <asp:SqlDataSource ID="sqlDSAttendance" runat="server" ConnectionString="<%$ ConnectionStrings:GG_CRMDBConnectionString %>"
                                SelectCommand="sprocCXCRMAgentAttendanceSelectItemListByAgentId" SelectCommandType="StoredProcedure">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="ddlAgent" Name="AgentID" PropertyName="SelectedValue"
                                        Type="Int64" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </fieldset>
        </div>
    </div>

</asp:Content>
